package com.epoint.flinkdemo.transform;

import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @author liufl
 * @version [版本号, 21-4-8]
 */
public class FilterTest
{
    public static void main(String[] args) throws Exception{
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        System.out.println("默认并行度=====>" + env.getParallelism());
        String[] words = {"apple","orange","banana","watermelon"};

        // 创建DataSource
        DataStreamSource<String> streamSource = env.fromElements(words);
        DataStream<String> filterStream = streamSource.filter(item->item.contains("an"));
        filterStream.print();

        env.execute();
    }
}
